package mysql

import "gorm.io/gorm"

type Good struct {
	gorm.Model
	GoodTitle  string `gorm:"type:varchar(100);comment:商品标题"`
	GoodPrice  int64  `gorm:"type:int(6);comment:商品价格"`
	GoodStock  int64  `gorm:"type:int(5);comment:商品库存"`
	GoodCover  string `gorm:"type:varchar(100);comment:商品状态"`
	GoodStatus int64  `gorm:"type:int(2);default:0;comment:商品状态"`
}

func (g *Good) GoodCreate() error {
	return db.Create(&g).Error
}
func (g *Good) GoodShow() (Good, error) {
	good := Good{}
	err2 := db.Where("id=?", g.ID).First(&good).Error
	return good, err2
}
